<?php
namespace app\data\controller\activity\user;

use app\data\model\ActUserModel;
use app\index\controller\BaseController;

class User extends BaseController
{
    /**
     * 网站用户管理
     * @auth true
     * @menu true
     * @return void
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        // 设置页面标题
        $this->title = '用户管理';

        // 数据查询分页
        ActUserModel::mQuery()
            ->order('id desc')
            ->like('phone,email,name')
            ->equal('status')
            ->page();
    }

    /**
     * 修改用户状态
     * @auth true
     */
    public function state()
    {
        ActUserModel::mSave($this->_vali([
            'status.in:1,2'  => '状态值范围异常！',
            'status.require' => '状态值不能为空！',
        ]));
    }

}